-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
-- PURPOSE.
-- See the Mulan PSL v2 for more details.
--
-- Author: auto generate
-- Create: 2025-10-19
-- Description: DO NOT EDIT; Code generated by "message.lua.mako"
local validate = require 'mc.validate'
local utils = require 'mc.utils'

local MDataSync = {}

---@class MDataSync.CommunicationType
---@field CommunicationType integer
local TCommunicationType = {}
TCommunicationType.__index = TCommunicationType
TCommunicationType.group = {}

local function TCommunicationType_from_obj(obj)
    return setmetatable(obj, TCommunicationType)
end

function TCommunicationType.new(CommunicationType)
    return TCommunicationType_from_obj({CommunicationType = CommunicationType or 0})
end
---@param obj MDataSync.CommunicationType
function TCommunicationType:init_from_obj(obj)
    self.CommunicationType = obj.CommunicationType or 0
end

function TCommunicationType:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TCommunicationType.group)
end

TCommunicationType.from_obj = TCommunicationType_from_obj

TCommunicationType.proto_property = {'CommunicationType'}

TCommunicationType.default = {0}

TCommunicationType.struct = {{name = 'CommunicationType', is_array = false, struct = nil}}

function TCommunicationType:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'CommunicationType', self.CommunicationType, 'uint8', false, errs, need_convert)

    TCommunicationType:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TCommunicationType.proto_property, errs, need_convert)
    return self
end

function TCommunicationType:unpack(_)
    return self.CommunicationType
end

MDataSync.CommunicationType = TCommunicationType

return MDataSync
